home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / tool-inc.zip / BORDER.INC < prev    next >
Text File  |  1989-03-01  |  3KB  |  100 lines

  1.  
  2. (*
  3.  * Copyright 1987, 1989 Samuel H. Smith;  All rights reserved
  4.  *
  5.  * This is a component of the ProDoor System.
  6.  * Do not distribute modified versions without my permission.
  7.  * Do not remove or alter this notice or any other copyright notice.
  8.  * If you use this in your own program you must distribute source code.
  9.  * Do not use any of this in a commercial product.
  10.  *
  11.  *)
  12.  
  13. (*
  14.  * border.inc - draw a border around a window
  15.  *
  16.  * S.H.Smith, 14-Nov-87
  17.  *
  18.  *)
  19.  
  20. type
  21.   border_styles = (blank_border,          single_border,
  22.                    double_border,         mixed_border,
  23.                    taildouble_border,
  24.                    solid_border,          evensolid_border,
  25.                    thinsolid_border,      lohatch_border,
  26.                    medhatch_border,       hihatch_border);
  27.  
  28. const
  29.   border_table:  array[blank_border..hihatch_border] of string[8] =
  30.     ('        ',  { blank     }         '┌─┐││└─┘',  { single    }
  31.      '╔═╗║║╚═╝',  { double    }         '╒═╕││╘═╛',  { mixed     }
  32.      '╠═╗║║╚═╝',  { taildouble}
  33.      '████████',  { solid     }         '█▀████▄█',  { evensolid }
  34.      '▐▀▌▐▌▐▄▌',  { thinsolid }         '░░░░░░░░',  { lohatch   }
  35.      '▒▒▒▒▒▒▒▒',  { medhatch  }         '▓▓▓▓▓▓▓▓'); { hihatch   }
  36.  
  37. procedure display_border(topx,topy,botx,boty: integer;
  38.                          style: border_styles);
  39.    (* display a window border.  enter with desired color settingx*)
  40. var
  41.    left:        string[80];
  42.    right:       string[80];
  43.    top:         string[80];
  44.    bottom:      string[80];
  45.    width:       integer;
  46.    b:           string[8];
  47.    i,j:         integer;
  48.  
  49. const
  50.    topleft  = 1;    {border character locations in border strings}
  51.    tophor   = 2;
  52.    topright = 3;
  53.    leftver  = 4;
  54.    rightver = 5;
  55.    botleft  = 6;
  56.    bothor   = 7;
  57.    botright = 8;
  58.  
  59.    filler = ^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J^@^H^J;
  60.  
  61. begin
  62.    b := border_table[style];
  63.    width := botx - topx - 2;
  64.  
  65. (* top and bottom of frame *)
  66.    bottom[0]    := chr(width+2);
  67.    top[0]       := chr(width+2);
  68.    top[1]       := b[topleft];
  69.    for i := 2 to width+1 do
  70.       top[i] := b[tophor];
  71.    top[width+2] := b[topright];
  72.    
  73.    bottom[0]       := chr(width+2);
  74.    bottom[1]       := b[botleft];
  75.    for i := 2 to width+1 do
  76.       bottom[i] := b[bothor];
  77.    bottom[width+2] := b[botright];
  78.    
  79.  
  80. (* sides of frame *)
  81.    left := filler + filler;
  82.    right := left;
  83.    j := 1;
  84.    for i := 2 to boty - topy do
  85.    begin
  86.       left[j]:= b[leftver];
  87.       right[j]:= b[rightver];
  88.       j := j + 3;
  89.    end;
  90.    left[0]:= chr (j - 1);
  91.    right[0]:= left[0];
  92.  
  93. (* draw the frame *)
  94.    gotoxy(topx,topy);     write(top);
  95.    gotoxy(topx,topy+1);   write(left);
  96.    gotoxy(botx-1,topy+1); write(right);
  97.    gotoxy(topx,boty);     write(bottom);
  98. end;
  99.  
  100.